1. Field of the Invention
The present invention relates to the technical field of digital image coding and decoding and, more particularly, to a Joint Bi-level Image Group (JBIG) coding and decoding system.
2. Description of Related Art
The well-known bi-level image compression standard is G3 and G4 fax compression standards. Upon the strong requirement in office automation (OA), a facsimile machine has become a newly popular office machine. However, the use limitation of such a facsimile machine may cause the problems as follows.
(1) The terminals have different resolutions. Current computer terminals do not include an entire fax document in the screen on display due to the resolution restriction.
(2) The function of browsing image data in real-time is not provided. Namely, the content can be read only when the entire image sheet is completely output by a facsimile machine.
(3) When a gray-level image is input, the output image quality is very poor. This is because the gray-level contrast data of the gray-level image is damaged when a facsimile machine performs a binary evaluation on a document that is input as a gray-level image to thereby obtain a bi-level image for further processing, and accordingly the output quality of the bi-level image is poor.
Therefore, a satisfactory bi-level image compression must have the capability of solving the aforementioned problems.
The Joint Bi-level Image Group (JBIG) is similar to the Joint Photographic Experts Group (JPEG) except that the JBIG applies a non-distortion compression and accordingly the compressed bi-level image can be restored completely.
The JBIG is operated by sending a version of image with low resolution and the additional compressed image data in accordance with the needs of the subjective and objective environments in order to enhance the quality of the blur image and gradually restore the original image, which is referred to as the function of JBIG progressive transfer. The JBIG compression has the following features:
(1) adaptive coding;
(2) lossless compression;
(3) progressive capability; and
(4) multi-level image processing capability.
The JBIG coding uses an adaptive arithmetic coding, so the effect of adaptive coding is obtained. The JBIG also regards a multi-level image as multiple bi-level images in order to compress, store and transfer each of the multiple bi-level images. Thus, the multi-level image can be processed by the JBIG In addition, the JBIG involves the halftone image compression and coding.
FIG. 1 is a schematic diagram of a typical JBIG coding system 100. As shown in FIG. 1, the JBIG coding system 100 receives a pixel PIX and the context CX corresponding to the pixel, which are applied to an adaptive arithmetic coding to thereby obtain a compressed data SCD.
FIG. 2 is a schematic diagram of a context corresponding to the pixel of FIG. 1. FIG. 3 is a schematic diagram of another context corresponding to the pixel of FIG. 1. As shown in FIGS. 2 and 3, “?” indicates the pixel to be input and coded, which is not a part of the context, and “A” indicates an adaptive pixel, which is a part of the context.
FIG. 4 is a flowchart of a typical JBIG coding. As shown in FIG. 4, the procedure INITENC is called to perform an initialization (step S410). The pixel PIX, the context CX and two values TPVALUE and DPVALUE are read (step S420). Step S430 determines if TPVALUE is not equal to two or DPVALUE is not equal to two. Step S450 is executed when TPVALUE is not equal to two or DPVALUE is not equal to two, and otherwise step S440 is executed to call the procedure ENCODE for coding. Step S450 determines if a strip of image is coded completely. The procedure FLUSH is called when the strip of image is coded completely, and otherwise step S420 is executed.
FIG. 5 is a flowchart of the procedure INITENC of FIG. 4.
FIG. 6 is a flowchart of the procedure ENCODE of FIG. 4.
FIG. 7 is a schematic diagram of a typical JBIG decoding system 200. As shown in FIG. 7, the JBIG decoding system receives a compressed data SCD and associated context CX and performs the adaptive arithmetic decoding on the received data and context to thereby produce the pixel PIX.
FIG. 8 is a flowchart of a typical JBIG decoding. As shown in FIG. 8, the procedure INITDEC is called to perform an initialization (step S1310). The compressed data SCD, the context CX and two values TPVALUE and DPVALUE are read (step S1320). Step S1330 determines if TPVALUE is not equal to two. The pixel PIX is set to the value TPVALUE (step S1340) when TPVALUE is not equal to two, and step S1350 is executed when TPVALUE is equal to two. Step S1350 determines if DPVALUE is not equal to two. The pixel PIX is set to the value DPVALUE (step S1360) when DPVALUE is not equal to two, and step S1370 is executed when DPVALUE is equal to two.
In step S1370, the procedure ENCODE is called to decode. Step S1380 determines if a strip of image is decoded completely. Step 1310 is executed when the strip of image is decoded completely, and otherwise step S1320 is executed.
FIG. 9 is a flowchart of the procedure INITDEC of FIG. 8.
FIG. 10 is a flowchart of the procedure DECODE of FIG. 8.
Accordingly, the JBIG encoder and decoder essentially use the adaptive arithmetic coding and decoding in compression and decompression. The adaptive arithmetic coding and decoding can provide a better compression effect, as compared to Huffman, modified Huffman (MH), modified READ (MR), modified modified READ (MMR) algorithms, but the time required for the operation is more than the cited algorithms.
To overcome the aforementioned problem, U.S. Pat. No. 6,870,491 granted to Thaly Amogh D. for a “Data decompression technique for image processing” discloses a fast data conversion, which decompresses the compressed data obtained after the arithmetic coding. In U.S. Pat. No. 6,870,491, a series of serial and parallel computational combinations is performed on the compressed data to thereby reduce the required decompression time. Also, the applied parallel processing can further reduce the required decompression time. However, the serial and parallel computational combinations are a partial arithmetic decoding, which can only reduce the limited time. In addition, this patent has focused only on the decompression, without describing the compression.
Therefore, it is desirable to provide an improved JBIG encoder and decoder to mitigate and/or obviate the aforementioned problems.